Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vim Mode 2022 #439

Open
wants to merge 89 commits into
base: master
Choose a base branch
from
Open

Vim Mode 2022 #439

wants to merge 89 commits into from

Conversation

tombh
Copy link
Member

@tombh tombh commented Jul 26, 2022

Can I finally get Vim Mode merged?

Fixes #236, #246 and #264

tobimensch and others added 30 commits October 7, 2018 14:45
The keybindings are hardcoded for now, but this is going to change.
Added moveTabLeft and moveTabRight functions, which take
a tab ID and try to move the tab as far right or left
in the tabOrder as possible.
Added previouslyVisitedTab function that switches to the
previously selected tab.
with activating input boxes using link hinting.
In Firefox 63 an old syntax for Marionette commands was deprecated.
Updating mostly just meant prepending `WebDriver` to existing commands.

This should fix most problems in #232
Vim mode still needs a lot more tests
…to key combinations only working after a certain number of key strokes.
tombh and others added 14 commits June 24, 2019 09:12
Vim mode still needs a lot more tests
…to key combinations only working after a certain number of key strokes.
This is because Travis' logs had 2 problems.
  1. it doesn't capture the entire log output
  2. it doesn't show logs when there's a timeout
… event could get interpreted repeatedly. Also some rewrites/improvements of the code. Key mappings can now contain control characters and meta keys with a vim-like notation. There's a hard insert mode, which disables all of browsh's shortcuts and requires 4 hits on ESC to leave. There's a new multiple link opening feature analogous to vimium, that's still incomplete.
After nearly 4 years I'm finally getting round to shipping all the
tremendous hard work of @tobimensch, @j-rewerts and @ed2k. I can't
apologise enough that it's taken so long.
@laughingbiscuit
Copy link

do you want to community to use and test for your fork prior to merge?

@martin-braun
Copy link

vimium in browsh will be a game changer for me!

@jivank
Copy link

jivank commented Jan 19, 2023

I was having trouble building this branch with the provided documentation. I assume the repo has a GitHub Action that successfully builds?

@tombh
Copy link
Member Author

tombh commented Jan 27, 2023

I would love help with this. The only thing that needs fixing to get this merged is the failing tests.

@jivank The local dev setup docs do indeed need updating. If you're on Linux or similar you can use https://github.com/browsh-org/browsh/blob/master/.github/workflows/main.yml for inspiration.

@jivank
Copy link

jivank commented Feb 3, 2023

I see in TTY tests:


Error: test/tty/tty_test.go:4:2: package browsh/interfacer/src/browsh is not in GOROOT (/opt/hostedtoolcache/go/1.18.10/x64/src/browsh/interfacer/src/browsh)

This is a similar error I was facing when I was attempting to build it on my local machine.

@isaacphi
Copy link

isaacphi commented Sep 4, 2024

@tombh What sort of help do you need with this PR as of now?

@tombh
Copy link
Member Author

tombh commented Sep 14, 2024

I never merged it because the tests failed. But considering that I've been giving Browsh so little attention, I guess I could just give up on the tests and make a release with this anyway. If enough people test this PR themselves then I suppose that's enough.

@heywoodlh
Copy link

All the keyboard shortcuts seem to work for me as expected! Would be nice if the README/website documentation included a list of the shortcuts -- or maybe just a link to

// Vim commands
vimKeyMap["normal gg"] = "scrollToTop"
vimKeyMap["normal G"] = "scrollToBottom"
vimKeyMap["normal j"] = "scrollDown"
vimKeyMap["normal k"] = "scrollUp"
vimKeyMap["normal h"] = "scrollLeft"
vimKeyMap["normal l"] = "scrollRight"
vimKeyMap["normal d"] = "scrollHalfPageDown"
vimKeyMap["normal <C-d>"] = "scrollHalfPageDown"
vimKeyMap["normal u"] = "scrollHalfPageUp"
vimKeyMap["normal <C-u>"] = "scrollHalfPageUp"
vimKeyMap["normal e"] = "editURL"
vimKeyMap["normal ge"] = "editURL"
vimKeyMap["normal gE"] = "editURLInNewTab"
vimKeyMap["normal H"] = "historyBack"
vimKeyMap["normal L"] = "historyForward"
vimKeyMap["normal J"] = "prevTab"
vimKeyMap["normal K"] = "nextTab"
vimKeyMap["normal r"] = "reload"
vimKeyMap["normal xx"] = "removeTab"
vimKeyMap["normal X"] = "restoreTab"
vimKeyMap["normal t"] = "newTab"
vimKeyMap["normal T"] = "searchForTab"
vimKeyMap["normal /"] = "findMode"
vimKeyMap["normal n"] = "findNext"
vimKeyMap["normal N"] = "findPrevious"
vimKeyMap["normal g0"] = "firstTab"
vimKeyMap["normal g$"] = "lastTab"
vimKeyMap["normal gu"] = "urlUp"
vimKeyMap["normal gU"] = "urlRoot"
vimKeyMap["normal <<"] = "moveTabLeft"
vimKeyMap["normal >>"] = "moveTabRight"
vimKeyMap["normal ^"] = "previouslyVisitedTab"
vimKeyMap["normal m"] = "makeMark"
vimKeyMap["normal '"] = "gotoMark"
vimKeyMap["normal i"] = "insertMode"
vimKeyMap["normal I"] = "insertModeHard"
vimKeyMap["normal yy"] = "copyURL"
vimKeyMap["normal p"] = "openClipboardURL"
vimKeyMap["normal P"] = "openClipboardURLInNewTab"
vimKeyMap["normal gi"] = "focusFirstTextInput"
vimKeyMap["normal f"] = "openLinkInCurrentTab"
vimKeyMap["normal F"] = "openLinkInNewTab"
vimKeyMap["normal <M-f>"] = "openMultipleLinksInNewTab"
vimKeyMap["normal yf"] = "copyLinkURL"
vimKeyMap["normal [["] = "followLinkLabeledPrevious"
vimKeyMap["normal ]]"] = "followLinkLabeledNext"
vimKeyMap["normal yt"] = "duplicateTab"
vimKeyMap["normal v"] = "visualMode"
vimKeyMap["normal ?"] = "viewHelp"
vimKeyMap["caret v"] = "visualMode"
vimKeyMap["caret h"] = "moveCaretLeft"
vimKeyMap["caret l"] = "moveCaretRight"
vimKeyMap["caret j"] = "moveCaretDown"
vimKeyMap["caret k"] = "moveCaretUp"
vimKeyMap["caret <Enter>"] = "clickAtCaretPosition"
vimKeyMap["visual c"] = "caretMode"
vimKeyMap["visual o"] = "swapVisualModeCursorPosition"
vimKeyMap["visual y"] = "copyVisualModeSelection"


I packaged this PR's commit as a Nix flake for use with the Nix package manager. See below if you are interested in easy installation/testing with Nix.

Flake is here: https://github.com/heywoodlh/flakes/tree/main/browsh

Run the flake with the following command:

nix --extra-experimental-features "nix-command flakes" run "github:heywoodlh/flakes?dir=browsh"

If you do this from Linux, my flake includes Firefox-ESR bundled with it, so it should just work. I've also provided an appimage of my bundled flake -- although, mileage may vary on how well it works as it was very slow for me:

curl -L "https://github.com/heywoodlh/flakes/releases/download/appimages/browsh-$(arch).appimage" -o /tmp/browsh.appimage && chmod +x /tmp/browsh.appimage

/tmp/browsh.appimage

@jooaf
Copy link

jooaf commented Sep 16, 2024

I tested the keyboard shortcuts using the Dockerfile posted here. i then built and tested the docker image from the root of the repo using the following:

docker build -t browsh-vim .
docker run --rm -ti browsh-vim https://hexdocs.pm/gleam_json

for those who are curious, i tested via my fork here
For the most part all of the keybinds seems to work! I did notice that the insert mode keybindings didn't work, but that could just be my terminal. Overall, works as expected thank you so much :)

@God-damnit-all
Copy link

I never merged it because the tests failed. But considering that I've been giving Browsh so little attention, I guess I could just give up on the tests and make a release with this anyway. If enough people test this PR themselves then I suppose that's enough.

It would be nice to have binaries for the latest version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants